<!--
@author: anjg
@date: 2024-08-13 08:53:13
@description: svg图标引入
-->
<template>
  <svg
    aria-hidden="true"
    :class="svgClass"
    :width="width"
    :height="height"
  >
    <use
      :xlink:href="symbolId"
      :fill="color"
    />
  </svg>
</template>
<script>
export default {
    name: 'svg-icon',
    props: {
        prefix: {
            type: String,
            default: 'icon'
        },
        iconName: {
            type: String,
            required: true
        },
        color: {
            type: String,
            default: '#444'
        },
        width: {
            type: String,
            default: '16px'
        },
        height: {
            type: String,
            default: '16px'
        },
        className: {
            type: String,
            default: ''
        }
    },
    computed: {
        symbolId() {
            return `#${this.prefix}-${this.iconName}`;
        },
        svgClass() {
            return this.className ? `svg-icon ${this.className}` : 'svg-icon';
        }
    },
    mounted() {}
};
</script>

<style scoped>
.svg-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
}
</style>
